* @ingroup JobQueue
*/
use MediaWiki\MediaWikiServices;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
/**
* Job to update link tables for pages
!( isset( $params['pages'] ) && count( $params['pages'] ) != 1 )
);
$this->params += [ 'causeAction' => 'unknown', 'causeAgent' => 'unknown' ];
+ // This will control transaction rounds in order to run DataUpdates
+ $this->executionFlags |= self::JOB_NO_EXPLICIT_TRX_ROUND;
}
/**
function run() {
global $wgUpdateRowsPerJob;
+ $ok = true;
// Job to update all (or a range of) backlink pages for a page
if ( !empty( $this->params['recursive'] ) ) {
// When the base job branches, wait for the replica DBs to catch up to the master.
if ( !isset( $this->params['range'] ) ) {
$lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
if ( !$lbFactory->waitForReplication( [
- 'wiki' => wfWikiID(),
+ 'domain' => $lbFactory->getLocalDomainID(),
'timeout' => self::LAG_WAIT_TIMEOUT
] ) ) { // only try so hard
$stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
JobQueueGroup::singleton()->push( $jobs );
// Job to update link tables for a set of titles
} elseif ( isset( $this->params['pages'] ) ) {
- foreach ( $this->params['pages'] as $nsAndKey ) {
- list( $ns, $dbKey ) = $nsAndKey;
- $this->runForTitle( Title::makeTitleSafe( $ns, $dbKey ) );
+ foreach ( $this->params['pages'] as list( $ns, $dbKey ) ) {
+ $title = Title::makeTitleSafe( $ns, $dbKey );
+ if ( $title ) {
+ $this->runForTitle( $title );
+ } else {
+ $ok = false;
+ $this->setLastError( "Invalid title ($ns,$dbKey)." );
+ }
}
// Job to update link tables for a given title
} else {
$this->runForTitle( $this->title );
}
- return true;
+ return $ok;
}
/**
$renderer = $services->getRevisionRenderer();
$ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
+ $lbFactory->beginMasterChanges( __METHOD__ );
+
$page = WikiPage::factory( $title );
$page->loadPageData( WikiPage::READ_LATEST );
$options['triggeringUser'] = User::newFromName( $userInfo['userName'], false );
}
}
+
+ $lbFactory->commitMasterChanges( __METHOD__ );
+
$page->doSecondaryDataUpdates( $options );
InfoAction::invalidateCache( $title );